/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package horizon.gui;

import PacketHandling.PacketHandler;
import genesisclient.GenesisClient;
import horizon.gui.component.GuiTextBlock;
import horizon.gui.component.GuiTextField;
import horizon.states.State;
import horizon.util.ExpandedColor;
import horizon.util.Vector2;
import java.awt.Color;

/**
 *
 * @author J_Laptop
 */
public class PlanetGui extends GuiOverlay{

    public GuiTextBlock chatWindow;
    public GuiTextField chatInput;
  
    
    public PlanetGui(State owner) {
        super(owner);
        Vector2 size = new Vector2(300, 100);
        Vector2 inputSize = new Vector2(300 , 20);
        Vector2 p = new Vector2(0 , GenesisClient.canvasHeight - size.getY() - inputSize.getY() - 2);
        Vector2 inputP = new Vector2(0 , p.getY() + size.getY() + 1);
        
        chatWindow = new GuiTextBlock("chat" , ExpandedColor.transGray, Color.black, Color.gray, size , p);
        chatInput = new GuiTextField("input" , Color.black, ExpandedColor.transBlack, Color.black ,inputSize , inputP){

            @Override
            public void enterPressed() {
                super.enterPressed();
                
                PacketHandler.getInstance().sendChatMessage(chatInput.getText());
                chatInput.setText("");
                
                
            }
           
            
        };
        
        
        this.addComponent(chatWindow);
        this.addComponent(chatInput);
       
    }
    
    public void addMessageToChat(String s){
        
        
            chatWindow.addLine(s);
       
    }
    
}
